import { defineStore } from 'pinia';

export const useFlagStore = defineStore('flag', {
  state: () => {
    return {
      isInfoBoardOpen: false,
      isFileListSpinnerShow: false,
      isPreviewerOpen: false,
      isPreviewSpinnerShow: false,
      isSearchBoardOpen: false,
      isSearchBoardSpinnerShow: false,
      isShareBoardOpen: false,
      isNotificationOpen: false,
      isPCContentSidebarOpen: false,
      isMobileContentSidebarOpen: true
    };
  },

  actions: {
    toggleFlag(key) {
      this[key] = !this[key];
    },
    setInfoBoardOpen(flag) {
      this.isInfoBoardOpen = flag;
    },
    setFileListLoading(flag) {
      this.isFileListSpinnerShow = flag;
    },
    setPreviewerOpen(flag) {
      this.isPreviewerOpen = flag;
    },
    setPreviewSpinner(flag) {
      this.isPreviewSpinnerShow = flag;
    },
    setSearchBoardOpen(flag) {
      this.isSearchBoardOpen = flag;
    },
    setSearchBoardSpinner(flag) {
      this.isSearchBoardSpinnerShow = flag;
    },
    setShareBoardOpen(flag) {
      this.isShareBoardOpen = flag;
    },
    setNotificationOpen(flag) {
      this.isNotificationOpen = flag;
    },
    setMobileContentSidebarOpen(flag) {
      this.isMobileContentSidebarOpen = flag;
    },
    setPCContentSidebarOpen(flag) {
      this.isPCContentSidebarOpen = flag;
    }
  }
});
